package com.lb.algorithm;

/**
 * @version 1.0
 * @Author: Edward
 * @Date: 2020/8/31 10:12
 * @Description:
 */
public class ParisTest {
    public static int inversePairs(int[] array) {
        if (array == null || array.length < 2) {
            return 0;
        }
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if (array[i] > array[j]) {
                    count++;
                }
            }
        }
        return count % 1000000007;
    }

    public static void main(String[] args) {
        int[] arr = new int[]{7,5,6,4};
        System.out.println(inversePairs(arr));
    }
}
